/**<
7. Write a program that calculates a random number 1 through 100. The program then asks the user to guess the number.
If the user guesses too high or too low then the program should output "too high" or "too low" accordingly.
The program must let the user continue to guess until the user correctly guesses the number.
 */

#include <iostream>
#include<cstdlib>
#include<ctime>

using namespace std;

 void RandomGuess()
 {
   //generate the random number
 srand(time(0));
 int nRandom = rand() % 100 + 1;

 //ask the user to guess until the # is correct
 cout << "Guess an integer betwen 1 and 100. " << endl;
 int nGuess = 0;
 while(nGuess != nRandom)
 {
    cin >> nGuess;
    if (nGuess > nRandom)
        cout << "Too HIGH. Try again." << endl;
    else if (nGuess < nRandom)
        cout << "Too LOW. Try again." << endl;
 }

    cout << "The number was " << nRandom << ". You guessed it!";   //tell the user they win
 }

